Under the Unix/linux system, the Gettimeofday function is used to obtain the timestamp of the current system, which can reach a microsecond (microsecond, or μs) level.The information for the current timestamp is stored through the struct
In the analysis of live555CodeOccasional acquisition:
If (fisfirstpacket) {// record the fact that we're starting to play now: gettimeofday (& fnextsendtime, null );}
UNIX and Linux time systems start from epoch, in seconds. Epoch is the
The basic time service provided by the Unix kernel is the number of seconds that have elapsed since 00:00:00, January 1, January 1, 1970 AD, The International Standard Time. This number of seconds is represented by the Data Type time_t.
1. The time
In project development, in order to improve the efficiency of the program, it is first to locate the part of the code that takes a long time, and then improves the code--to shorten the execution time. This takes a time to get the function to get the
UNIX time can be roughly divided into real-time and time in the struct.
1 \ calculate the number of seconds from 1900 to 1970 rfc1305-Network Time Protocol. In the network protocol, the timestamp format is a four-eight-bit group. The value is the
IOS Time Processing
Do not have to do the app to deal with time, about the processing of time, there are many doorways, far from a row of API calls, get the current system time so simple. We need to understand the differences between the various
microtime-returns the current Unix timestamp and microseconds description
Mixed Microtime ([bool $get _as_float])
Microtime () The current Unix timestamp and the number of microseconds. This function is only available under an operating system
about Unix Time
①time_t Data Typetypedef long int time_t; Used to store the number of seconds from 1970 to the present.
②timeval Structural Bodystruct Timeval
{
Long tv_sec; /* SEC * *
Long tv_usec; /* microsecond * *
};
Structure struct Timeval,
I have been reading books and taking some notes recently.
The operating system used in this article is centos7.0. If you do not want to install a dual-system, you can install a virtual machine, refer to
Objective
A good timer helps program developers determine the performance bottlenecks of a program, or perform performance comparisons on different algorithms. However, it is not easy to accurately measure the running time of the program, because
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.